package pzl.com.waitnotify.tasks;

import pzl.com.waitnotify.beans.Resource;

/**
 * @author zl.peng
 * @version [1.0, 2016-11-15]
 */
public class Input implements Runnable {

    private Resource r;

    public Input(Resource r) {
        this.r = r;
    }

    @Override
    public void run() {
        int count = 0;
        while (true) {
            if (count == 0) {
                r.set("Tom", "man");
            } else {
                r.set("Lily", "woman");
            }
            //在连个数据之间进行切换。
            count = (count + 1) % 2;
        }
    }

}


